#include "proc.h"

struct queue{
	struct proc processes[64];
	int size;
};

void initQueue(struct queue* waiters){

	int i;
	for(i = 0; i < 64; i++){
		waiters->processes[i] = 0;
	}
	waiters->size = 0;
}

void enqueue(int p, struct queue* waiters){
	waiters->processes[waiters->size] = p;
	waiters->size++;
}

int dequeue(struct queue* waiters){
	int returnProc = -1;
	int i = 0;
	if(waiters->size <= 0){
		printf(1,"queue is empty");
	}
	else{
		returnProc = waiters->processes[0];
		for(i = 1; i < waiters->size; i++){
			waiters->processes[i-1] = waiters->processes[i];
		}
		waiters->size--;
	}
	return returnProc;
}
